package com.tuniu.agents.common.command;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.tuniu.agents.advisor.ChatEnvironmentMemory;
import com.tuniu.agents.agent.AgentManager;
import com.tuniu.agents.command.match.PatternMatch;
import com.tuniu.agents.common.command.action.DefaultCallAgentAction;
import com.tuniu.agents.common.command.action.DefaultCallHandlerAction;
import com.tuniu.agents.common.command.action.DefaultOutputTextAction;
import com.tuniu.agents.common.command.match.StringMatch;
import com.tuniu.agents.memory.MemoryManager;
import com.tuniu.agents.message.MessageSender;

@Configuration
public class CommandConfiguration {

    @Bean("defaultCallAgentAction")
    public DefaultCallAgentAction defaultCallAgentAction(AgentManager agentManager) {
        return new DefaultCallAgentAction(agentManager);
    }

    @Bean("defaultOutputTextAction")
    public DefaultOutputTextAction defaultOutputTextAction() {
        return new DefaultOutputTextAction();
    }

    @Bean("defaultCallHandlerAction")
    public DefaultCallHandlerAction defaultCallHandlerAction(AgentManager agentManager, MemoryManager memoryManager, ChatEnvironmentMemory chatEnvironmentMemory, MessageSender messageSender) {
        return new DefaultCallHandlerAction(agentManager, memoryManager, chatEnvironmentMemory, messageSender);
    }

    @Bean("stringMatch")
    public StringMatch stringMatch() {
        return new StringMatch();
    }

    public static final String ALL_MATCH = "allMatch";

    @Bean(ALL_MATCH)
    public PatternMatch patternMatch() {
        return new PatternMatch(".*");
    }

}
